package com.woniuxy.service.impl;

import com.woniuxy.bean.RoleBean;
import com.woniuxy.dao.RoleDao;
import com.woniuxy.dao.UserDao;
import com.woniuxy.pojo.PageBean;
import com.woniuxy.pojo.Role;
import com.woniuxy.pojo.User;
import com.woniuxy.service.RoleService;
import com.woniuxy.service.UserService;
import com.woniuxy.utils.Contants;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleDao roleDao;

    @Override
    public List<Role> getRoleListByPage(PageBean pageBean) {
        return roleDao.getRoleListByPage(pageBean);
    }

    @Override
    public Integer getTotalSize(PageBean pageBean) {
        return roleDao.getTotalSize(pageBean);
    }

    @Override
    public Integer getPages(Integer totalSize, Integer pageSize) {
        return totalSize%pageSize==0?totalSize/pageSize:totalSize/pageSize+1;
    }

    @Override
    public Integer[] getMenuIdsByRoleId(Integer roleId) {
        return roleDao.getMenuIdsByRoleId(roleId);
    }
}
